package view;
import javafx.scene.Group;
import vinciappli.Templates;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.scene.text.Font;
import javafx.scene.paint.Color;
import javafx.scene.layout.LayoutInfo;
import javafx.scene.control.Label;
import javafx.geometry.VPos;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.StrokeLineCap;
import control.ControllerPrincipal;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 * @author Sik
 */
 public def PLUS_BUTTON : Integer = 0;
 public def MINUS_BUTTON : Integer = 1;
 public def NONE_BUTTON : Integer = 2;

public class ZoneInteraction extends Group
{
    public var x : Number;
    public var y : Number;
    public-read var height : Number = 80;
    public-read var width : Number = 120;
    
    public var interactions : InteractButton[];
    var fx = ["{{Templates.GUI_PATH}}plus.png", "{{Templates.GUI_PATH}}moins.png", "{{Templates.GUI_PATH}}none.png"];

    var myFont: Font =
    Font
    {
        name: "Impact"
        size: 15
    }

    public function build() : Void
    {
        for(element in fx)
        {
             var ib = InteractButton
                {
                    image: "file:///{{element}}"
                }
            insert ib into interactions;
        }
    }


    init
    {
        ini();
        blocksMouse = true;
        content =
        {
            Group
            {
                content :
                [
                    Rectangle
                    {
                        height: height
                        width: width
                        arcWidth: 20 arcHeight: 20
                        fill: Color.GRAY
                        opacity: 0.5
                        stroke: Color.WHITESMOKE
                        strokeWidth: 3
                        strokeLineCap: StrokeLineCap.ROUND
                    }
                    VBox
                    {
                        translateX: 5
                        translateY: 7
                        content:
                        [
                            HBox
                            {
                                spacing: 10
                                content:
                                [
                                    interactions[PLUS_BUTTON],
                                    Label
                                    {
                                        text: "Ajouter"
                                        font: myFont
                                        textFill: Color.WHITE
                                        layoutInfo: LayoutInfo
                                        {
                                            height: interactions[PLUS_BUTTON].height;
                                        }
                                        vpos: VPos.CENTER

                                    }
                                ]
                            }
                            HBox
                            {
                                spacing: 10
                                content:
                                [
                                    interactions[MINUS_BUTTON],
                                    Label
                                    {
                                        text: "Retirer"
                                        font: myFont
                                        textFill: Color.WHITE
                                        layoutInfo: LayoutInfo
                                        {
                                            height: interactions[MINUS_BUTTON].height;
                                        }
                                        vpos: VPos.CENTER
                                    }
                                ]
                            }
                            HBox
                            {
                                spacing: 10
                                content:
                                [
                                    interactions[NONE_BUTTON],
                                    Label
                                    {
                                        text: "Abandonner"
                                        font: myFont
                                        textFill: Color.WHITE
                                        layoutInfo: LayoutInfo
                                        {
                                            height: interactions[NONE_BUTTON].height;
                                        }
                                        vpos: VPos.CENTER
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
    }

    public function ini(): Void
    {
        build();
        
    }

    public function close(): Void
    {
    }
}
